package com.v1.video.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.v1.video.R;

public class EditTitleView extends RelativeLayout{

	@SuppressWarnings("deprecation")
	public EditTitleView(Context context, AttributeSet attrs) {
		super(context, attrs);
		
		TypedArray tArray = context.obtainStyledAttributes(attrs, R.styleable.edit_title);
		
        String text = tArray.getString(R.styleable.edit_title_android_text);
        Drawable left = tArray.getDrawable(R.styleable.edit_title_left_background);
        Drawable right = tArray.getDrawable(R.styleable.edit_title_right_background);
        
        
        tArray.recycle();
        
        
		View.inflate(context, R.layout.layout_edit_title, this);
		
		TextView title = (TextView) findViewById(R.id.tv_title);
		ImageButton back = (ImageButton)findViewById(R.id.ib_back);
		ImageButton next = (ImageButton) findViewById(R.id.ib_next);
		
		if(text!=null)
			title.setText(text);
		
		if(left!=null)
			back.setBackgroundDrawable(left);
		if(right!=null)
			next.setBackgroundDrawable(right);
	}

}
